import React, { Component } from 'react'
import { NavLink, Redirect, Route } from 'react-router-dom'
import Homes from './Homes'
// import { withRouters } from '../utils/withRouter'
// import { withRouter } from 'react-router-dom'

class Home extends Component {
    pushDetail = () => {
        // this.props.history.push('/detail')
        console.log(this.props)
    }
    render() {
        return (
            <div>
                <p>
                我是Home页面
                </p>
                <NavLink activeStyle={{
                    color: "skyblue"
                }} to="/home/homes">我是二级的</NavLink>
                {/* <NavLink activeClassName='abc' to="/home/homes">我是二级的</NavLink> */}
                <div>
                    <button onClick={() => {
                        this.pushDetail()
                    }}>点我跳转</button>
                </div>
                <Route path="/home/homes" component={Homes} />
            </div>
        )
    }
}

// Home = withRouters(Home)
// 高阶组件
// function isAuth(Com) {
//     return class NewCom extends Component {
//         render() {
//             if (sessionStorage.getItem('token')) {
//                 <Com/>
//             } else {
//                 <Redirect to="/login"/>
//             }
//         }
//     }
// }



export default Home
